﻿
using FreeSql.DataAnnotations;
using System.Collections.Generic;
using System.Text;

namespace Rswl.Common.Core.User.Aggregate.Entities
{
    [Table(Name ="rswl_user_ext")]
  
   public class UserExtInfo
    {
        public UserExtInfo()
        {

        }

        public UserExtInfo(string userId, string openId, string avatar, string nick, string appId, string unionId)
        {
            UserId = userId;
            OpenId = openId;
            Avatar = avatar??"";
            Nick = nick??"";
            AppId = appId;
            UnionId = unionId??"";
            CreateDate = DateTime.Now;
        }

        [Column(IsIdentity =true)]
        public long Id { get; set; }

       
        public string UserId { get; set; }
       
        public string OpenId { get; set; }
       
        public string Avatar { get; set; }
       
        public string Nick { get; set; }

        
        public string AppId { get; set; }
        
        public string UnionId { get; set; }

        
        public DateTime CreateDate { get; set; }

        public void ChangeAvatar(string avatar)
        {
            if(!string.IsNullOrWhiteSpace(avatar))
            Avatar = avatar;
           
        }
        public void ChangeNick(string nick)
        {
            if(!string.IsNullOrWhiteSpace(nick))
 Nick = nick;
        }
        public void UpdateUnionId(string unionId)
        {
            if(!string.IsNullOrWhiteSpace(unionId))
            UnionId = unionId;
        }
    }
}
